<?php echo $this->fetch('header.html'); ?>
<script type="text/javascript" src="index.php?act=jslang"></script>
<script type="text/javascript">
    //<!CDATA[
    $(function(){
        $('#recom_form').validate({
            errorPlacement: function(error, element){
                $(element).next('.field_notice').hide();
                $(element).after(error);
            },
            success       : function(label){
                label.addClass('right').text('OK!');
            },
            onkeyup    : false ,
            rules : {
                recom_name : {
                    required : true ,
                    remote   : {
                        url :'index.php?app=recommend&act=check_recom' ,
                        type:'get',
                        data:{
                            recom_name : function(){
                                return $('#recom_name').val();
                            },
                            id : '<?php echo $this->_var['recommend']['recom_id']; ?>'
                        }
                    }
                }
            },
            messages : {
                recom_name : {
                    required : '推荐类型不能为空',
                    remote   : '您输入的推荐类型名称已存在，请重新输入'
                }
            }
        });
    });
    //]]>
</script>
<div id="rightTop">
    <p>推荐类型</p>
    <ul class="subnav">
        <li><a class="btn1" href="index.php?app=recommend">管理</a></li>
        <?php if ($this->_var['recommend']['recom_id']): ?>
        <li><a class="btn1" href="index.php?app=recommend&amp;act=add">新增</a></li>
        <?php else: ?>
        <li><span>新增</span></li>
        <?php endif; ?>
    </ul>
</div>
<div class="info">
    <form method="post" enctype="multipart/form-data" id="recom_form">
        <table class="infoTable">
            <tr>
                <th class="paddingT15"> 上级分类:</th>
                <td class="paddingT15 wordSpacing5">
                    <select name="parent_id">

                        <option value="0" selected>顶级分类</option>
                        <?php $_from = $this->_var['recommends']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('key', 'item');if (count($_from)):
    foreach ($_from AS $this->_var['key'] => $this->_var['item']):
?>
                        <option <?php if ($this->_var['recommend']['parent_id'] == $this->_var['item']['recom_id']): ?> selected="selected" <?php endif; ?> value="<?php echo $this->_var['item']['recom_id']; ?>"><?php echo $this->_var['item']['recom_name']; ?></option>
                        <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?>
                    </select>
                    <label class="field_notice">上级分类</label>
                </td>
            </tr>
            <tr>
                <th class="paddingT15"> 推荐类型:</th>
                <td class="paddingT15 wordSpacing5">
                    <input type="radio" name="type" value="star" <?php if ($this->_var['recommend']['type'] == 'star'): ?>checked<?php endif; ?> /> 明星推荐
                    <input type="radio" name="type" value="editor" <?php if ($this->_var['recommend']['type'] == 'editor'): ?>checked<?php endif; ?> /> 编辑推荐
                    <input type="radio" name="type" value="index" <?php if ($this->_var['recommend']['type'] == 'index'): ?>checked<?php endif; ?> /> 首页推荐
                </td>
            </tr>
            <tr>
                <th class="paddingT15"> 推荐类型名称:</th>
                <td class="paddingT15 wordSpacing5">
                    <input class="infoTableInput2" name="recom_name" type="text" id="recom_name" value="<?php echo htmlspecialchars($this->_var['recommend']['recom_name']); ?>" />
                    <label class="field_notice">推荐类型名称</label>
                </td>
            </tr>
            <tr>
                <th class="paddingT15"> 推荐类型标题:</th>
                <td class="paddingT15 wordSpacing5">
                    <input class="infoTableInput2" name="recom_title" type="text" id="recom_title" value="<?php echo htmlspecialchars($this->_var['recommend']['recom_title']); ?>" />
                    <label class="field_notice">推荐类型标题</label>
                </td>
            </tr>
            <tr>
                <th class="paddingT15"> 推荐类型内容:</th>
                <td class="paddingT15 wordSpacing5">
                    <textarea class="infoTableInput2" name="recom_content" id="recom_content" ><?php echo htmlspecialchars($this->_var['recommend']['recom_content']); ?></textarea>
                    <label class="field_notice">推荐类型内容</label>
                </td>
            </tr>
            <tr>
                <th class="paddingT15"> 手机端上传图片:</th>
                <td class="paddingT15 wordSpacing5">
                    <input name="file" type="file" multiple="true">
                    <?php if ($this->_var['recommend']['recom_image']): ?>
                    <img src="<?php echo $this->_var['recommend']['recom_image']; ?>"/>
                    <?php endif; ?>
                </td>
            </tr>
            
            <tr>
                <th class="paddingT15"> 电脑端上传图片:</th>
                <td class="paddingT15 wordSpacing5">
                    <input name="pc_file" type="file" multiple="true">
                    
                    <?php if ($this->_var['recommend']['pcrecom_image']): ?>
                    <img src="<?php echo $this->_var['recommend']['pcrecom_image']; ?>"/>
                    <?php endif; ?>
                </td>
            </tr>
            <tr>
                <th></th>
                <td class="ptb20">
                    <input class="formbtn" type="submit" name="Submit" value="提交" />
                    <input class="formbtn" type="reset" name="Reset" value="重置" />
                </td>
            </tr>
        </table>
    </form>
</div>
<?php echo $this->fetch('footer.html'); ?>
